cos_ebd <- "data/raw/OnlyOccurrences/ebd_coshum_smp_relAug-2024.txt"
observations <- read_ebd(cos_ebd)
ruf_ebd <- "data/raw/OnlyOccurrences/ebd_rufhum_smp_relAug-2024.txt"
observations2 <- read_ebd(ruf_ebd)
# This analysis only uses presence data (not presence and absence data) because of the scale, the data files are too large to download and work with presence and absence data across the full species range for both of these species.
# Changing coordinates to sf object for visualization
observations_sf <- observations %>%
# convert to spatial points
st_as_sf(coords = c("longitude", "latitude"), crs = 4326)
# Code from ebird best practices
observations2_sf <- observations2 %>%
# convert to spatial points
st_as_sf(coords = c("longitude", "latitude"), crs = 4326)
hummingbird_obs <- bind_rows(observations_sf, observations2_sf)Eco Topic 2 Individual Report
Big Data in Ecology
README
EcoTopic2 is a group project that analyzes migration patterns of two hummingbird species completed by Mikaely Evans, Tori Duckworth, and Seth Lorenzen. This data was taken from the Cornell Lab’s eBird citizen science application. eBird uses bird observation data input by civilian users all over the world through checklist format where users denote where, how many, when, and how they observed birds in the wild. In our analysis, we focus on two hummingbird species: the Rufous and the Costa’s Hummingbirds. A link to the eBird website is here https://ebird.org/home
Introduction
Climate change is reshaping ecosystems on the global scale, one of the most fascinating impacts is its effect on bird migration patterns, which are shifting in response to rising temperatures and altered seasonal cues. In this analysis, we study the migration patterns of two different hummingbird species, the Rufous and the Costa’s Hummingbirds. These species differ in overall population sizes, appearance, and preferred habitat, but the most significant difference is the lengths of their migration. The Rufous hummingbird has a migration range of almost 4,000 miles, from Canada to southern Mexico spanning the length of the entire United States, which is the longest migration of any hummingbird. The Costa’s hummingbird migrates shorter distances from British Columbia, CA to Mexico staying along the west coast. Hummingbird migration depends on the timing and severity of winter conditions (Graham et al.) which cause hummingbirds to migrate south in search of warmth and resources (Remolina-Figueroa et al., Lopez-Segoviano et al.). Due to global warming, hummingbirds have had to adjust their migration timing to ensure that the necessary resources are available for them during their journey (Courter). The ability of hummingbirds to successfully adapt to these changes determines their species survival, mating success, and provided ecosystem services. Our goals for this project are to understand the migration patterns of the hummingbirds and compare the patterns to changing temperatures, land use, and conservation action to determine whether these species are successful in adaptation to climate change. We hypothesize that the Costa’s hummingbird species will be more successful in adapting to climate change because they have a smaller range and therefore will not deal with the extreme variability of changing temperatures between Canada and Mexico, nor the extreme weather events that occur in their range.
Code
Loading in the data:
Plots
hummingbird_obs %>%
filter(year(observation_date) > 2000) %>%
group_by(year(observation_date), common_name) %>%
ggplot(aes(x = year(observation_date), fill = common_name)) +
geom_bar(position = "dodge") +
labs(title = "Yearly Count of Rufous and Costa's Hummingbirds Observations",
x = "Year", y = "Observations", fill = "Species")# Code adapted from Tori Duckworth
ruf_mx <- hummingbird_obs %>%
filter(common_name == "Rufous Hummingbird") %>%
filter(country == "Mexico") %>%
ggplot(aes(x = month(observation_date))) +
geom_bar() +
scale_x_continuous(breaks = seq(0, 12, by = 2)) +
labs(x = "Month", y = "", title = "Mexico")
ruf_us <- hummingbird_obs %>%
filter(common_name == "Rufous Hummingbird") %>%
filter(country == "United States") %>%
ggplot(aes(x = month(observation_date))) +
geom_bar() +
scale_x_continuous(breaks = seq(0, 12, by = 2)) +
labs(x = "Month", y = "", title = "United States")
ruf_ca <- hummingbird_obs %>%
filter(common_name == "Rufous Hummingbird") %>%
filter(country == "Canada") %>%
ggplot(aes(x = month(observation_date))) +
geom_bar() +
scale_x_continuous(breaks = seq(0, 12, by = 2)) +
labs(x = "Month", y = "", title = "Canada")
grid.arrange(ruf_ca, ruf_us, ruf_mx,
nrow = 3,
top = textGrob("Monthly Rufous Hummingbird Observations by Country",
gp = gpar(fontsize = 14)),
left = textGrob("Number of Observations", rot = 90))# Code adapted from Tori Duckworth
cos_mx <- hummingbird_obs %>%
filter(common_name == "Costa's Hummingbird") %>%
filter(country == "Mexico") %>%
ggplot(aes(x = month(observation_date))) +
geom_bar() +
scale_x_continuous(breaks = seq(0, 12, by = 2)) +
labs(x = "Month", y = "", title = "Mexico")
cos_us <- hummingbird_obs %>%
filter(common_name == "Costa's Hummingbird") %>%
filter(country == "United States") %>%
ggplot(aes(x = month(observation_date))) +
geom_bar() +
scale_x_continuous(breaks = seq(0, 12, by = 2)) +
labs(x = "Month", y = "", title = "United States")
cos_ca <- hummingbird_obs %>%
filter(common_name == "Costa's Hummingbird") %>%
filter(country == "Canada") %>%
ggplot(aes(x = month(observation_date))) +
geom_bar() +
scale_x_continuous(breaks = seq(0, 12, by = 2)) +
labs(x = "Month", y = "", title = "Canada")
grid.arrange(ruf_ca, ruf_us, ruf_mx,
nrow = 3,
top = textGrob("Monthly Costa's Hummingbird Observations by Country",
gp = gpar(fontsize = 14)),
left = textGrob("Number of Observations", rot = 90))# Code adapted from Seth Lorenzen
# Making plots of observation latitude and longitude by month for each species
r_month_lat <- observations2 %>%
ggplot(aes(x = month(observation_date), y = latitude)) +
geom_point(color = "#de8241") +
geom_smooth(aes(group=1), se = F, color = "#7e2915") +
labs(title = "Monthly Rufous Latitude", x = "Month", y = "Latitude")
c_month_lat <- observations %>%
ggplot(aes(x = month(observation_date), y = latitude)) +
geom_point(color = "#b504e2") +
geom_smooth(aes(group=1), se = F, color = "#543a5c") +
labs(title = "Monthly Costa's Latitude", x = "Month", y = "Latitude")
r_month_long <- observations2 %>%
ggplot(aes(x = month(observation_date), y = longitude)) +
geom_point(color = "#de8241") +
geom_smooth(aes(group=1), se = F, color = "#7e2915") +
labs(title = "Monthly Rufous Longitude", x = "Month", y = "Longitude")
c_month_long <- observations %>%
ggplot(aes(x = month(observation_date), y = longitude)) +
geom_point(color = "#b504e2") +
geom_smooth(aes(group=1), se = F, color = "#543a5c") +
labs(title = "Monthly Costa's Longitude", x = "Month", y = "Longitude")
library(gridExtra)
grid.arrange(r_month_lat, r_month_long, c_month_lat, c_month_long, nrow = 2, ncol = 2)# Code adapted from Seth Lorenzen
# Creating a new factor variable for decade of observation
observations_rufous <- observations2 %>%
mutate(decade = floor(year(observation_date) / 10) * 10)
observations_rufous <- observations_rufous %>%
mutate(decade = factor(decade))
observations_costa <- observations %>%
mutate(decade = floor(year(observation_date) / 10) * 10)
observations_costa <- observations_costa %>%
mutate(decade = factor(decade))
# Making plots of average monthly longitude by decade
# Costa Latitude
c_decmonth_lat <- ggplot(data = observations_costa, aes(x = month(observation_date), y = latitude, color = decade)) +
geom_smooth(aes(group = decade), se = F) +
labs(title = "C. costae Average Monthly Latitude of Observation by Decade", x = "Month", y = "Latitude", color = "Decade")
# Costa Longitude
c_decmonth_long <- ggplot(data = observations_costa, aes(x = month(observation_date), y = longitude, color = decade)) +
geom_smooth(aes(group = decade), se = F) +
labs(title = "C. costae Average Monthly Longitude of Observation by Decade", x = "Month", y = "Longitude", color = "Decade")
# Rufous Latitude
r_decmonth_lat <- ggplot(data = observations_rufous, aes(x = month(observation_date), y = latitude, color = decade)) +
geom_smooth(aes(group = decade), se = F) +
labs(title = "S. rufus Average Monthly Latitude of Observation by Decade", x = "Month", y = "Latitude", color = "Decade")
# Rufous Longitude
r_decmonth_long <- ggplot(data = observations_rufous, aes(x = month(observation_date), y = longitude, color = decade)) +
geom_smooth(aes(group = decade), se = F) +
labs(title = "S. rufus Average Monthly Longitude of Observation by Decade", x = "Month", y = "Longitude", color = "Decade")
grid.arrange(r_decmonth_lat, c_decmonth_lat, nrow = 2)grid.arrange(r_decmonth_long, c_decmonth_long, nrow = 2)# Creating Map of species distribution
hummingbird_obs$month <- format(as.Date(hummingbird_obs$observation_date), "%m")
# Load country borders data (USA, Canada, Mexico)
world <- ne_countries(scale = "medium", returnclass = "sf")
# Create the base plot using the geometry directly
monthlyp <- ggplot() +
geom_sf(data = world, fill = "gray80", color = "gray50") + # Base map
geom_sf(data = hummingbird_obs, aes(color = common_name), size = 2, alpha = 0.6) + # Bird points
scale_color_manual(values = c("Costa's Hummingbird" = "#b504e2", "Rufous Hummingbird" = "#de8241")) +
coord_sf(xlim = c(-130, -60), ylim = c(10, 60)) +
labs(title = 'Month: {closest_state}', color = 'Species') +
theme_minimal() +
theme(legend.position = "right")
monthlyp
# Animate over time (months)
animated_plot <- monthlyp +
transition_states(month, transition_length = 2, state_length = 1) +
ease_aes('linear')
# Render the animation
bird_gif <- gganimate::animate(animated_plot, nframes = 100, fps = 10)
anim_save("hummingbird_migration.gif", animation = bird_gif)Discussion
In order to understand Rufous and Costa’s Hummingbird migration patterns, the first plot shows the species ranges which were discussed in the introduction. Next, the yearly count of Rufous and Costa’s Hummingbird occurrences is given to show the overall trends of the species populations. As shown, both species follow exponential growth patterns, but this growth has slowed in the past 4 years. It’s possible that this plateau is due to the bird populations struggling to adapt to climate change, or that eBird usership is plateauing and leading to a slow-down in observations. In order to analyze this trend fully, it would be important to take into account both the presence and absence data of the hummingbirds so we can see if the eBird overall observation occurrences follow this same trend. The next two figures show barplots of hummingbird occurrences per country by month where the Rufous and Costa’s hummingbirds spend the summer months primarily in the United States and Canada and the winter months in Mexico. Following this, the monthly latitude and longitude of Rufous and Costa’s Hummingbirds are shown in a dot plot with smooth trend lines. The latitude and longitude of the Rufous hummingbirds are much more variable than those of the Costa’s. These trends show what we were expecting to find and give us a more visual understanding of the migration patterns of both the Rufous and Costa’s Hummingbirds. Next, to analyze our hypothesis, plots of the average monthly latitude by decade for each species show how the timing of migration is changing. The average monthly latitude for both of the hummingbird species smoothes out over time with lines from earlier decades showing more drastic changes. It is possible that these deeper curves in the 1950’s, 60’s and 70’s are due to less data that was available in those years that eBird technology was not as widely used as it is now. The average monthly longitude of the hummingbird species across the decades shows that the Costa’s average monthly longitude has been increasing steadily since 1950. It is possible that this shift in average monthly longitude shows adaptation to the warming climate causing the Costa’s Hummingbirds to stay at a lower longitude year-round. This result confirms our hypothesis that the Costa’s hummingbird species will be more successful in adapting to climate change because of their smaller range. Finally, our analysis ends with a map showing the Rufous and Costa’s Hummingbird observation data on a map that is animated to show the yearly hummingbird migration patterns. When working with citizen-science data, it is important to recognize the bias that bird observations are only recorded when people are using eBird and this data does not represent the exact population of each entire bird species. Along with this, there are also more observations in the United States than Canada and Mexico because eBird is mostly used in the US. On the same vein, there are more observations in larger cities like Los Angeles, CA and Phoenix, AZ where there are more people that are likely to use the app. The next steps for this analysis would be to compare the observation data of the Rufous and Costa’s Hummingbirds to the eBird checklist data that did not observe either of these hummingbird species in order to assess whether these trends are linked to overall trends in eBird data. It would also be important to look at the factors that impact hummingbird migration including temperature changes, land use changes, vegetation indices, and conservation action. Looking into these variables will explain why we are seeing the trends that we do and give us a better look into how hummingbirds are successfully adapting to climate change.
Works Cited
Correa-Lima, Ana Paula Araujo, et al. “Spatio-temporal effects of climate change on the geographical distribution and flowering phenology of hummingbird-pollinated plants.” Annals of botany 124.3 (2019): 389-398. https://academic.oup.com/aob/article/124/3/389/5532755
Graham, Catherine H., et al. “Winter conditions influence biological responses of migrating hummingbirds.” Ecosphere 7.10 (2016): e01470. https://esajournals.onlinelibrary.wiley.com/doi/full/10.1002/ecs2.1470 Remolina-Figueroa, Daniela, et al. “Together forever? Hummingbird-plant relationships in the face of climate warming.” Climatic Change 175.1 (2022): 2. https://link.springer.com/article/10.1007/s10584-022-03447-3
Courter, Jason R. “Changes in spring arrival dates of rufous hummingbirds (Selasphorus rufus) in Western North America in the past century.” The Wilson Journal of Ornithology 129.3 (2017): 535-544. https://meridian.allenpress.com/wjo/article-abstract/129/3/535/130276/Changes-In-Spring-Arrival-Dates-of-Rufous
Lopez-Segoviano, Gabriel, et al. “Hummingbird migration and flowering synchrony in the temperate forests of northwestern Mexico.” PeerJ 6 (2018): e5131. https://peerj.com/articles/5131/